package com.yizhu.zczy.project.controller;

import java.util.Arrays;
import java.util.Map;


import com.yizhu.zczy.common.utils.PageUtils;
import com.yizhu.zczy.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.yizhu.zczy.project.entity.ItemInfoEntity;
import com.yizhu.zczy.project.service.ItemInfoService;




/**
 * 项目信息提供表
 *
 * @author guoyz
 * @email guoyz@mail.com
 * @date 2021-06-24 17:33:48
 */
@RestController
@RequestMapping("project/iteminfo")
public class ItemInfoController {
    @Autowired
    private ItemInfoService itemInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("project:iteminfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = itemInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{infoId}")
    //@RequiresPermissions("project:iteminfo:info")
    public R info(@PathVariable("infoId") Integer infoId){
		ItemInfoEntity itemInfo = itemInfoService.getById(infoId);

        return R.ok().put("itemInfo", itemInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("project:iteminfo:save")
    public R save(@RequestBody ItemInfoEntity itemInfo){
		itemInfoService.save(itemInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("project:iteminfo:update")
    public R update(@RequestBody ItemInfoEntity itemInfo){
		itemInfoService.updateById(itemInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("project:iteminfo:delete")
    public R delete(@RequestBody Integer[] infoIds){
		itemInfoService.removeByIds(Arrays.asList(infoIds));

        return R.ok();
    }

}
